#ifndef _HEADER_WaterTank0_H
#include "WaterTank0.h"
#endif

//关闭自来水进水开关
void WaterTank0::closeWaterIn()
{
    waterSwitchIn.close();
}
//关闭自来水出水开关
void WaterTank0::closeWaterOut()
{
    waterSwitchOut.close();
}
//返回自来水罐是否满，通过调用WaterLine获取
bool WaterTank0::isFull()
{
    //跟据感器是否等于low来确定是否为满
    isFullState = waterLine.getState() == LOW;
    return isFullState;
}
//打开进水开关
void WaterTank0::openWaterIn()
{
    waterSwitchIn.open();
}
//关闭出水开关
void WaterTank0::openWaterOut()
{
    waterSwitchOut.close();
}

void WaterTank0::toString(char* inStr)
{
    char tmp1[200],tmp2[200],tmp3[200],tmp4[200];
    outPump.toString(tmp1);
    waterLine.toString(tmp2);
    waterSwitchIn.toString(tmp3);
    waterSwitchOut.toString(tmp4);
    sprintf(inStr,"WaterTank0:{isFull=%d,outPump=%s,waterLine=%s,waterSwitchIn=%s,waterSwitchOut=%s}",
        isFullState,tmp1,tmp2,tmp3,tmp4);
}
